//
//  HeadTableViewCell.m
//  易车
//
//  Created by dllo on 15/11/10.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "HeadTableViewCell.h"
#define kWIDTH self.frame.size.width
#define kHEIGHT self.frame.size.height

@implementation HeadTableViewCell

- (void)dealloc
{
    [_titleView release];
    [_label release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)layoutSubviews{
    NSArray *array = @[@"贷款买车", @"直销车型", @"底价买车", @"二手车"];
    for (int i = 0; i < 4; i++) {
        self.titleView = [[UIImageView alloc] init];
        NSMutableString *string = [NSMutableString stringWithFormat:@"%d.png", i + 1];
        self.titleView.image = [UIImage imageNamed:string];
        self.titleView.frame = CGRectMake(10 + kWIDTH / 4 * i, 10, kWIDTH / 4 - 20, kWIDTH / 4 - 20);
        
        [self addSubview:self.titleView];
        [self.titleView release];
        
        self.label = [[UILabel alloc] init];
        self.label.text = array[i];
        self.label.frame = CGRectMake(15 + kWIDTH / 4 * i, kWIDTH / 4, kWIDTH / 4, 40);
        
        [self addSubview:self.label];
        [self.label release];
    }
}

- (void)createView{
//    NSArray *array = @[@"贷款买车", @"直销车型", @"底价买车", @"二手车"];
//    for (int i = 0; i < 4; i++) {
//        self.titleView = [[UIImageView alloc] init];
//        NSMutableString *string = [NSMutableString stringWithFormat:@"%d.png", i + 1];
//        self.titleView.image = [UIImage imageNamed:string];
//        self.titleView.frame = CGRectMake(10 + kWIDTH / 4 * i, 10, kWIDTH / 4 - 20, kWIDTH / 4 - 20);
//        
//        [self addSubview:self.titleView];
//        [self.titleView release];
//        
//        self.label = [[UILabel alloc] init];
//        self.label.text = array[i];
//        self.label.frame = CGRectMake(10 + kWIDTH / 4 * i, kWIDTH / 4, kWIDTH / 4, 40);
//        
//        [self addSubview:self.label];
//        [self.label release];
//    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
